package com.jash.labor.controller;

import com.jash.labor.entity.Labor;
import com.jash.labor.mapper.LaborMapper;
import com.jash.labor.service.LaborService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import java.sql.Timestamp;

@Api(tags = "工人相关接口")
@RestController
@RequestMapping(value = "/labor", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class LaborController {
    @Resource
    /*
    添加
     */

    private LaborService laborService;
    @ApiOperation(value = "新增工人信息接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "sex",value = "工人信息")
            }
    )
    @RequestMapping(value = "/add")
    public Object add(@RequestBody Labor labor){

        return laborService.add(labor);
    }
    /*
    编辑
     */
    @ApiOperation(value = "编辑工人信息接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "sex",value = "工人信息"),
            }
    )
    @RequestMapping(value = "/edit")
    public Object edit(@RequestBody Labor labor){
        return laborService.edit(labor);
    }

    /*
    根据性别查询
     */
    @ApiOperation(value = "按性别查询工人列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "sex",value = "性别"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )
    @RequestMapping(value = "/queryListPage")
    public Object queryListPage(
            @RequestParam(value = "sex") String sex,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return laborService.queryListPage(sex,pageNo,pageSize);
    }

    //按id查询工人信息
    @ApiOperation(value = "工人端我的 查询工人信息")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "id",value = "工人id关键字"),
            }
    )
    @RequestMapping(value = "/selectLaborId")
    public Object selectLaborId(@RequestParam("id") Integer id){

        return laborService.selectLaborId(id);
    }

    //工人端我的    报名中查询
    @ApiOperation(value = "工人端我的收益 报名查询列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "id",value = "工人id关键字"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )
    @RequestMapping(value = "/selectLaborEnroll")
    public Object selectLaborEnroll(
            @RequestParam(value = "id") Integer id,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){

        return laborService.selectLaborEnroll(id,pageNo,pageSize);
    }

    //工人端我的   成功入职查询
    @ApiOperation(value = "工人端我的收益 签约查询列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "id",value = "工人id关键字"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )
    @RequestMapping(value = "/selectLaborCheck")
    public Object selectLaborCheck(
            @RequestParam(value = "id") Integer id,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){

        return laborService.selectLaborCheck(id,pageNo,pageSize);
    }

    @ApiOperation(value = "工人端我的收益 总效绩列表接口")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "id",value = "工人id关键字"),
                    @ApiImplicitParam(name = "pageNo",value = "第几页"),
                    @ApiImplicitParam(name = "pageSize",value = "每页显示条数")
            }
    )
    @RequestMapping(value = "/selectLaborCheckIs")
    public Object selectLaborCheckIs(
            @RequestParam(value = "id") Integer id,
            @RequestParam(value = "pageNo") Integer pageNo,
            @RequestParam(value = "pageSize",required = false,defaultValue = "10") Integer pageSize
    ){
        return laborService.selectLaborCheckIs(id,pageNo,pageSize);
    }

}
